﻿//工程树节点具体对象的容器
var treeNodeObj = [];
//var imagelayer = {
//    servertype: "",
//    name:"",
//    option: null,
//    tc: 0,
//    serialnumber: 1,
//    status: true,
//    fun:""
//};
var imagelayers = [];
var terra = {
    name: "",
    option: null,
    tc: 0,
    status: true,
    fun: ""
};
var jjsj_layers = [];

function drde() {
    var key = "";
    var mvtLayer = createMVTWithStyle(sgworld._cesium, ol, createMapboxStreetsV6Style, {
        url: configureUrl.MVTUrl,
        key: key,
        ellipsoid: sgworld._cesium.Ellipsoid.WGS84,
        tileHeight: 256,
        tileWidth: 256
    });
    sgworld.Creator.createMVTWithStyle("wer", mvtLayer, 0);
}

//wfs
function testBillboardWfs() {
    window.sgworld.CreateWfs(sgworld._Viewer, "http://192.168.1.40:8090/geoserver/swagger/wms?", "swagger:point", 2, {
        "billboard": {
            "color": {
                "red": 1,
                "green": 1,
                "blue": 1,
                "alpha": 1
            },
            "image": { "defaultValue": "http://localhost/Cesium1.5.6/Apps/SampleData/pin.png" },
            "imageColor": { "defaultValue": { "red": 1, "green": 1, "blue": 1, "alpha": 1 } },
            "imageOpacity": { "defaultValue": "1" },
            "scaleTE": { "defaultValue": "15000" },
            "limitGrowth": { "defaultValue": "1" },
            "minViewingHeightObj": { "defaultValue": "0" }
        },
        "lineToGround": { "defaultValue": "1" },
        "lineToGroundLength": { "defaultValue": "0" },
        "lineToGroundColor": { "defaultValue": { "red": 1, "green": 1, "blue": 1, "alpha": 1 } },
        "altitudeMethod": 0,
        "altitudeOffset": { "defaultValue": "0" }
    }, "swagger:point", undefined, undefined, undefined);
}

function testLinewfs() {
    window.sgworld.CreateWfs(sgworld._Viewer, "http://36.7.136.132:8091/SG/Streamer.ashx", "nanjing.455207", 2, {
        "polyline": {
            "material": {
                "defaultValue": {
                    "red": 1,
                    "green": 1,
                    "blue": 1,
                    "alpha": 1
                }
            },
            "width": { "defaultValue": "0" },
            "lineOpacity": { "defaultValue": "1" },
            "fillColor": {
                "defaultValue": {
                    "red": 0.39215686274509803,
                    "green": 0.39215686274509803,
                    "blue": 0.39215686274509803,
                    "alpha": 1
                }
            },
            "wallAlpha": { "defaultValue": "0" },
            "widthInMeters": false,
            "backgroundOpacity": 0
        }, "altitudeMethod": 2, "altitudeOffset": { "defaultValue": "0" }
    }, "YDL_近期道路.458645", undefined, undefined, undefined);
}

function testLabelwfs() {
    window.sgworld.CreateWfs(sgworld._Viewer, "http://192.168.1.146:6080/arcgis/services/地级城市驻地/MapServer/WFSServer", "地级城市驻地", 2, {
        "label": {
            "text": { "defaultValue": "1234" },
            "scaleMPP": { "defaultValue": "15000" },
            "fillColor": { "defaultValue": { "red": 1, "green": 1, "blue": 1, "alpha": 1 } },
            "scaleByDistance": { "near": 150, "nearValue": 1, "far": 8000000, "farValue": 0 },
            "minViewingHeight": { "defaultValue": "0" },
            "font": { "defaultValue": "12" },
            "family": { "defaultValue": "Arial" },
            "backgroundColor": {
                "defaultValue": {
                    "red": 0.5019607843137255,
                    "green": 0.5019607843137255,
                    "blue": 0.5019607843137255,
                    "alpha": 1
                }
            },
            "backgroundOpacity": { "defaultValue": "0" },
            "italic": { "defaultValue": "0" },
            "bold": { "defaultValue": "0" },
            "limitGrowth": { "defaultValue": "1" },
            "textRelativeToImage": { "defaultValue": "0" },
            "showText": { "defaultValue": "0" },
            "textAlignment": { "defaultValue": "17" }
        },
        "lineToGround": { "defaultValue": "0" },
        "lineToGroundLength": { "defaultValue": "0" },
        "lineToGroundColor": { "defaultValue": { "red": 1, "green": 1, "blue": 1, "alpha": 1 } },
        "altitudeMethod": 0,
        "altitudeOffset": { "defaultValue": "0" }
    }, "地级城市驻地", undefined, undefined, undefined);
}

function testPolygonwfs() {
    window.sgworld.CreateWfs(sgworld._Viewer, "http://36.7.136.132:8091/SG/Streamer.ashx", "nanjing.455207", 3, {
        "polygon": {
            "outlineColor": {
                "defaultValue": {
                    "red": 1,
                    "green": 1,
                    "blue": 1,
                    "alpha": 1
                }
            },
            "outlineWidth": 1,
            "fill": { "defaultValue": "0" },
            "outline": { "defaultValue": "1" },
            "material": {
                "defaultValue": {
                    "red": 0.39215686274509803,
                    "green": 0.39215686274509803,
                    "blue": 0.39215686274509803,
                    "alpha": 1
                }
            },
            "fromKml": true
        }, "altitudeMethod": 2, "altitudeOffset": { "defaultValue": "0" }
    }, "nanjing.455207", undefined, undefined, undefined);
}

//将styletype和servertype属性与返回的id进行进行关联存储
var imageProvider = null;
var treeNodeObj = {};
function treeStart(data, pid) {
    //获取数据中的ztree树数据
    if (data.length > 0) {
        for (var i = 0, l = data.length; i < l; i++) {
            //判断节点类型
            if (data[i].type === 'group') {
                //获取当前组的id作为子节点的父id
                var id = sgworld.ProjectTree.createGroup(data[i].name, false, pid);
                //判断是否有子元素
                if (data[i].children && data[i].children.length > 0) {
                    treeStart(data[i].children, id)
                }
            } else {
                //遍历layerObj对象获取当前数据的servertype和datatype

                //添加数据时把当前数据应用的样式存储起来，避免sdk处理数据后样式数据被污染
                var d_style = JSON.parse(JSON.stringify(data[i].style));
                if (sqllayerObj && typeof sqllayerObj === 'object') {
                    for (key in sqllayerObj) {
                        if (key === data[i].id) {
                            data[i].datatype = sqllayerObj[key].datatype;
                            data[i].servertype = sqllayerObj[key].servertype;
                            data[i].styletype = sqllayerObj[key].styletype;
                            data[i].style = sqllayerObj[key].style;
                            break;
                        }
                    }
                }

                if (data[i].datatype == "model") {

                    if (data[i].style && data[i].style.indexOf("http") != -1) {
                        duq(data[i].name, data[i].url, data[i].styletype, data[i].servertype, data[i].style, data[i].checked, pid);
                    } else {
                        imageProvider = sgworld.Creator.create3DTilesets(data[i].name, data[i].url, {}, {}, pid, data[i].checked, "");
                    }
                    xl = true;
                } else if (data[i].datatype == "geojson") {
                    if (data[i].servertype == "geojson") { //
                        // var urls = data[i].url + "?workspace=swagger&layer=" + data[i].layername;
                        var urls = data[i].url ;
                        duq(data[i].name, urls, data[i].styletype, data[i].servertype, data[i].style, data[i].checked, pid);
                    }
                    if (data[i].servertype == "vector") { //切片
                        var geooption = 
                        // {
                        //     url: data[i].url,
                        //     layer: data[i].layername,
                        //     upperLevelLimit: 16,
                        //     lowerLevelLimit: 13,
                        //     minx: data[i].minx,
                        //     miny: data[i].miny,
                        //     maxx: data[i].maxx,
                        //     maxy: data[i].maxy
                        // };
                        {"url":"http://192.168.1.40:8090/geoserver/gwc/service/wmts","layer":"swagger:_20200409064613_nanjing","upperLevelLimit":21,"lowerLevelLimit":10,"minx":118.729523686,"miny":32.0272181353,"maxx":118.8090157,"maxy":32.0811466761999};
                        duq(data[i].name, geooption, data[i].styletype, data[i].servertype, data[i].style, data[i].checked, pid);
                    }

                    xl = true;
                } else if (data[i].datatype == "terrain") {
                    var utls = {
                        url: data[i].url,
                        requestVertexNormals: true
                    };
                    imageProvider = sgworld.Creator.createTerrain(data[i].name, utls, pid, data[i].checked, "");
                    //数据存储
                    terra.name = data[i].name;
                    terra.option = utls;

                    xl = true;
                } else if (data[i].datatype == "tiff") {
                    if (data[i].servertype == "skymap") {
                        var dx = {
                            url: data[i].url,
                            layer: data[i].Layername,
                            style: data[i].style,
                            maximumLevel: 20,
                            format: "image/jpeg",
                            level: data[i].level,
                            tileMatrixSetID: data[i].datatype,
                            show: data[i].status,
                            subdomains: ["t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7"]
                        }
                        //数据存储
                        imageProvider = sgworld.Creator.createWebMapTileServerImageLayer(data[i].name, dx, pid, data[i].serialnumber, data[i].checked, "");
                        var imagelayer = {
                            id: imageProvider.treeobj.id,
                            name: data[i].name,
                            servertype: data[i].servertype,
                            option: dx,
                            status: data[i].status
                        };
                        imagelayers.push(imagelayer);
                    }
                    if (data[i].servertype == "arcgis") {
                        var dx = {
                            url: data[i].url,
                            level: data[i].level,
                            enablePickFeatures: false
                        }
                        //数据存储
                        imageProvider = sgworld.Creator.createArcGisImageryLayer(data[i].name, dx, pid, data[i].serialnumber, data[i].checked, "");
                        var imagelayer = {
                            id: imageProvider.treeobj.id,
                            name: data[i].name,
                            servertype: data[i].servertype,
                            option: dx,
                            status: data[i].status
                        };
                        imagelayers.push(imagelayer);
                    }
                    if (data[i].servertype == "googlemap") {
                        var dx = {
                            url: data[i].url,
                            level: data[i].level,
                            enablePickFeatures: false
                        }
                        //数据存储
                        imageProvider = sgworld.Creator.createUrlTemplateImageryProvider(data[i].name, dx, pid, data[i].serialnumber, data[i].checked, "");
                        var imagelayer = {
                            id: imageProvider.treeobj.id,
                            name: data[i].name,
                            servertype: data[i].servertype,
                            option: dx,
                            status: data[i].status
                        };
                        imagelayers.push(imagelayer);
                    }
                    if (data[i].servertype == "geoserver") {
                        var dx = {
                            url: data[i].url,
                            level: data[i].level,
                        }
                        //数据存储
                        imageProvider = sgworld.Creator.createWebMapServerImageLayer(data[i].name, dx, pid, data[i].serialnumber, data[i].checked, "");
                        var imagelayer = {
                            id: imageProvider.treeobj.id,
                            name: data[i].name,
                            servertype: data[i].servertype,
                            option: dx,
                            status: data[i].status
                        };
                        imagelayers.push(imagelayer);
                    }
                    xl = true;
                } else if (data[i].datatype == "MVT") {
                    var key = "";
                    var mvtLayer = createMVTWithStyle(sgworld._cesium, ol, createMapboxStreetsV6Style, {
                        url: data[i].url,
                        key: key,
                        ellipsoid: sgworld._cesium.Ellipsoid.WGS84,
                        tileHeight: 256,
                        tileWidth: 256
                    });
                    var iyt = sgworld._Viewer.imageryLayers.addImageryProvider(mvtLayer);
                    sgworld.ProjectTree.insertProjectTree(pid, "", data[i].name, sgworld.ProjectTree.exitsObjectType.imageLabel, iyt, false);
                    var Item = sgworld.ProjectTree.findItem(wejml[j].name + "\\" + data[i].name);
                    sgworld.ProjectTree.setVisibility(Item, false);
                    xl = true;
                } else if (data[i].datatype == "ellipsoid") {
                    var zb = data[i].style.split(",");
                    var ellipsoid = {
                        radii: new sgworld._cesium.Cartesian3(60.0, 60.0, 60.0),
                        material: sgworld._cesium.Color.YELLOW
                    }
                    imageProvider = sgworld.Creator.executeEllipsoid(zb, ellipsoid, data[i].name, pid);
                    xl = true;
                } else if (data[i].datatype == "primiviteModel") { //私有类型 矢量切片 面 拉伸
                    var styleobj = data[i].style.split(",");
                    var GroupID = sgworld.ProjectTree.findItem("矢量");
                    var geooption = {
                        url: data[i].url,
                        layer: data[i].layername,
                        upperLevelLimit: 16,
                        lowerLevelLimit: 13,
                        minx: data[i].minx,
                        miny: data[i].miny,
                        maxx: data[i].maxx,
                        maxy: data[i].maxy
                    };

                    duq(data[i].name, data[i].url, data[i].styletype, data[i].servertype, styleobj, data[i].checked, GroupID);
                    xl = true;
                } else if (data[i].datatype == "primiviteWall") { //私有类型 矢量切片 面 拉伸
                    var styleobj = data[i].style.split(",");
                    var GroupID = sgworld.ProjectTree.findItem("矢量");
                    var urls = data[i].url + "?workspace=swagger&layer=" + data[i].layername;
                    duq(data[i].name, urls, data[i].styletype, data[i].servertype, styleobj, data[i].checked, GroupID);
                    xl = true;
                }
                //对返回数据进行处理
                treeNodeObj[imageProvider.treeobj.id] = {
                    'datatype': data[i].datatype,
                    'servertype': data[i].servertype,
                    'styletype': data[i].styletype,
                    'style' : d_style
                }
            }
        }
    }
}

//获取街景
function jjsj(url) {
    var vars = url.split("&");
    for (var i = 0; i < vars.length; i++) {
        var pair = vars[i].split("=");
        if (pair[1]) {
            return { url: pair[1], alpha: 1 };
        }
    }
}

function duq(name, urls, styletype, servertype, data, checked, lx) {
    // var url = "config" + Folder + "/" + style;
    if (styletype == 'billboardlayer') {
        if (servertype == "vector") {
            urls.upperLevelLimit = data.level_max;
            urls.lowerLevelLimit = data.level_min;
            imageProvider = sgworld.Creator.createBillboardGeoJsonFeatureLayerProvider(name, urls, data, lx, checked, "");
        } else {
            imageProvider = sgworld.Creator.createBillboardGeoJsonFeature(name, urls, data, lx, checked, "");
        }
    } else if (styletype == 'labellayer') {
        if (servertype == "vector") {
            urls.upperLevelLimit = data.level_max;
            urls.lowerLevelLimit = data.level_min;
            if (data.textType == "rich") {
            } else {
                imageProvider = sgworld.Creator.createPrimitiveLabelGeoJsonFeatureLayerProvider(name, urls, data, lx, checked, "");
            }
        } else {
            if (data.collect) {
                imageProvider = sgworld.Creator.createLabelPolymerizationGeoJsonFeatureLayer(name, urls, data, lx, checked, "");
            } else {
                if (data.textType == "rich") {
                    imageProvider = sgworld.Creator.createLabelRichtextGeoJsonFeatureLayerProvider(name, urls, data, lx, checked, "");
                } else {
                    imageProvider = sgworld.Creator.createLabelPointGeoJsonFeatureLayer(name, urls, data, lx, checked, "");
                }
            }
        }
    } else if (styletype == 'pointlayer') {//基础点
        if (servertype == "vector") {
            urls.upperLevelLimit = data.level_max;
            urls.lowerLevelLimit = data.level_min;
            imageProvider = sgworld.Creator.createPointGeoJsonFeatureLayerProvider(name, urls, data, lx, checked, "");
        } else {
            if (data.collect) {
                imageProvider = sgworld.Creator.createPointPolymerizationGeoJsonFeatureLayer(name, urls, data, lx, checked, "");
            } else {
                imageProvider = sgworld.Creator.createPointGeojsonFeatureLayer(name, urls, data, lx, checked, "");
            }
        }
    } else if (styletype == 'Streetscape') {
        //街景完善
        if (servertype == "vector") {
            urls.upperLevelLimit = data.level_max;
            urls.lowerLevelLimit = data.level_min;
            jjsj_layers.push(jjsj(url));
            imageProvider = sgworld.Creator.createPrimitivePolylineVectorGeoJsonFeatureLayerProvider(name, urls, data, lx, checked, "");
        } else {
            jjsj_layers.push(jjsj(url));
            imageProvider = sgworld.Creator.createStreetscapeGeoJsonFeatureLayer(name, urls, data, lx, checked, "");

        }
    } else if (styletype == 'polylinelayer') {
        //sgworld.Creator.createPolylineGeoJsonFeatureLayer(name, urls, data, lx, checked, "");
        if (servertype == "vector") {
            urls.upperLevelLimit = data.level_max;
            urls.lowerLevelLimit = data.level_min;
            imageProvider = sgworld.Creator.createPrimitivePolylineVectorGeoJsonFeatureLayerProvider(name, urls, data, lx, checked, "");
        } else {
            imageProvider = sgworld.Creator.createPrimitiveGroundPolylineGeoJsonFeatureLayer(name, urls, data, lx, checked, "");
        }
    } else if (styletype == 'polylinemodellayer') {
        //沿线模型分布
        //sgworld.Creator.createPolylineGeoJsonFeatureLayer(name, urls, data, lx, checked, "");
        if (servertype == "vector") {
            imageProvider = sgworld.Creator.createPolylineVectorGeoJsonFeatureLayerProviderModel(name, urls, data, lx, checked, "");
        } else {
            imageProvider = sgworld.Creator.exectPointModel(name, urls, data, lx, checked, "");
        }
    } else if (styletype == 'polygonmodellayer') {
        //面模型分布
        //sgworld.Creator.createPolylineGeoJsonFeatureLayer(name, urls, data, lx, checked, "");
        if (servertype == "vector") {
            imageProvider = sgworld.Creator.createPolygonVectorGeoJsonFeatureLayerProviderModel(name, urls, data, lx, checked, "");
        } else {
            imageProvider = sgworld.Creator.createPolygonModel(name, urls, data, lx, checked, "");
        }
    } else if (styletype == 'polygonbase') {
        //贴地面
        if (servertype == "vector") {
            urls.upperLevelLimit = data.level_max;
            urls.lowerLevelLimit = data.level_min;
            if (data.ground == "1") {
                data.extrudedHeightReference = 1;
                ////sgworld.Creator.createPolygonVectorGeoJsonFeatureLayerProviderls(name, urls, data, lx, checked, "");
                //sgworld.Creator.createPolygonVectorGeoJsonFeatureLayer(name, urls, data, lx, checked, "");
                imageProvider = sgworld.Creator.createGeoJsonFeatureLayerProviderOptimization(name, urls, data, lx, checked, "");
            } else {
                // imageProvider = sgworld.Creator.createGeoJsonFeatureLayerProviderClassOptimization(name, urls, data, lx, checked, "");
                imageProvider = sgworld.Creator.createGeoJsonFeatureLayerProviderClassOptimization(name, urls, data, lx, checked, "");
                //sgworld.Creator.createPolygonVectorGeoJsonFeatureLayerProvider(name, urls, data, lx, checked, "");
                ////sgworld.Creator.createVolumeVectorGeoJsonFeatureLayerDth(name, urls, data, lx, checked, "");
            }
        } else {
            if (data.material.indexOf(".jpg") != -1) {
                //水面
                imageProvider = sgworld.Creator.createPolygonMapGeoJsonFeatureLayer(name, urls, data, lx, checked, "");
            } else {
                // imageProvider = sgworld.Creator.createPolygonGeoJsonFeatureLayer(name, urls, data, lx, checked, "");
                imageProvider = sgworld.Creator.createPolygonGeoJsonFeatureLayer(name, urls, data, lx, checked, function(item){
                    sgworld.Navigate.flyTo(item);
                });
            }
        }
    } else if (styletype == 'polygonlayer') {
        //拉伸面
        if (servertype == "vector") {
            urls.upperLevelLimit = parseInt(data.level_max);
            urls.lowerLevelLimit = parseInt(data.level_min);
            data.classificationType=0;
            if (data.classificationType == 0) {
                //sgworld.Creator.createPolygonVectorGeoJsonFeatureLayer(name, urls, data, lx, checked, "");
                imageProvider = sgworld.Creator.createGeoJsonFeatureLayerProviderOptimization(name, urls, data, lx, checked, "");
            } else {
                data.classificationType = 2;
                data.ground = "1";
                imageProvider = sgworld.Creator.createGeoJsonFeatureLayerProviderClassOptimization(name, urls, data, lx, checked, "");
                //sgworld.Creator.createPolygonVectorGeoJsonFeatureLayerProvider(name, urls, data, lx, checked, "");
            }
        } else {
            if (data.material.indexOf(".jpg") != -1) {
                //水面
                imageProvider = sgworld.Creator.createPolygonMapGeoJsonFeatureLayer(name, urls, data, lx, checked, "");
            } else {
                imageProvider = sgworld.Creator.createPolygonGeoJsonFeatureLayer(name, urls, data, lx, checked, "");
            }
        }
    } else if (styletype == 'modellayer') {
        if (servertype == "vector") {
            //模型点
            urls.upperLevelLimit = data.level_max;
            urls.lowerLevelLimit = data.level_min;
            imageProvider = sgworld.Creator.createModelGeoJsonFeatureLayerProvider(name, urls, data, lx, checked, "");
        } else {
            imageProvider = sgworld.Creator.createModelPointGeoJsonFeatureLayer(name, urls, data, lx, checked, "");
        }
    } else if (styletype == "polylinevolumelayer") {
        if (servertype == "vector") {
            urls.upperLevelLimit = data.level_max;
            urls.lowerLevelLimit = data.level_min;
            imageProvider = sgworld.Creator.createVolumeGeoJsonFeatureLayerProvider(name, urls, data, lx, checked, "");
            //sgworld.Creator.createVolumeVectorGeoJsonFeatureLayerOptimizations(name, urls, data, lx, checked, "");
        } else {
            imageProvider = sgworld.Creator.createpolylineVolumeGeojsonFeatureLayer(name, urls, data, lx, checked, "");
        }
    } else if (styletype == "polylineWallLayer") { //墙类型样式加载entity
        if (servertype == "vector") {
            urls.upperLevelLimit = data.level_max;
            urls.lowerLevelLimit = data.level_min;
            imageProvider = sgworld.Creator.createWallGeoJsonFeatureLayerProvider(name, urls, data, lx, checked, "");
        } else {
            imageProvider = sgworld.Creator.createWallGeoFeatureLayer(name, urls, data, lx, checked, "");
        }
    }
    //else if (styletype == "polygonlayer") { //切片box分块加载
    //    if (servertype == "vector") {
    //        urls.upperLevelLimit = data.level_max;
    //        urls.lowerLevelLimit = data.level_min;
    //        sgworld.Creator.createPolygonVectorGeoJsonFeatureLayerProvider(name, urls, data, lx, checked, "");
    //    } else {
    //    }
    //}
    else if (styletype == "primiviteModels") { //切片box全部加载
        //urls.upperLevelLimit = data.level_max;
        //urls.lowerLevelLimit = data.level_min;
        imageProvider = sgworld.Creator.createPolygonVectorGeoJsonFeatureLayer(name, urls, data, data.level_max, data.level_min, lx, checked, "");
    } else if (styletype == "primiviteWall") { //墙全加载Primitive
        if (servertype == "vector") {
        } else {
            imageProvider = sgworld.Creator.createWallPrimitiveGeoFeatureLayer(name, urls, data, lx, checked, "");
        }
    } else if (styletype == "model") {
        if (servertype == "vector") {
        } else {
            var style = {
                colors: data.material,
                show: checked,
                groundheight: data.groundheight
            }

            var date = {
                //classificationType: data.classificationType,
                dynamicScreenSpaceErrorDensity: data.dynamicScreenSpaceErrorDensity,
                dynamicScreenSpaceErrorFactor: data.dynamicScreenSpaceErrorFactor,
                dynamicScreenSpaceErrorHeightFalloff: data.dynamicScreenSpaceErrorHeightFalloff,
                luminanceAtZenith: data.luminanceAtZenith,
                shadows: data.shadows
            };
            imageProvider = sgworld.Creator.create3DTilesets(name, urls, date, style, lx, checked, "");
        }
    } else if (styletype == "pointcloudmodel") {
        if (servertype == "vector") {
        } else {
            imageProvider = sgworld.Creator.create3DTilesets(name, urls, {}, data, lx, checked, "");
        }
    } else {
        imageProvider = sgworld.Creator.createGeoJsonFeatureLayer(name, urls, data, lx, "");
    }

}

//无样式数据加载
function wys(name, urls, styletype, servertype, style, checked, lx) {
    if (name == '银行') {
    }
    if (styletype == 'billboardlayer') {
        if (servertype == "vector") {
            urls.upperLevelLimit = 1;
            urls.lowerLevelLimit = 21;
            sgworld.Creator.createBillboardGeoJsonFeatureLayerProvider(name, urls, {}, lx, checked, "");
        } else {
            sgworld.Creator.createBillboardGeoJsonFeature(name, urls, {}, lx, checked, "");
        }
    } else if (styletype == 'labellayer') {
        if (servertype == "vector") {
            urls.upperLevelLimit = 1;
            urls.lowerLevelLimit = 21;
            sgworld.Creator.createPrimitiveLabelGeoJsonFeatureLayerProvider(name, urls, {}, lx, checked, "");
        } else {
            sgworld.Creator.createLabelPointGeoJsonFeatureLayer(name, urls, {}, lx, checked, "");
        }
    } else if (styletype == 'pointlayer') {
        if (servertype == "vector") {
            urls.upperLevelLimit = 1;
            urls.lowerLevelLimit = 21;
            sgworld.Creator.createPointGeoJsonFeatureLayerProvider(name, urls, {}, lx, checked, "");
        }
        //else {
        //    sgworld.Creator.createPointGeojsonFeatureLayer(name, urls, data, lx, checked, "");
        //}
    } else if (styletype == 'Streetscape') {
        //街景完善
        if (servertype == "vector") {
            urls.upperLevelLimit = 21;
            urls.lowerLevelLimit = 1;
            jjsj_layers.push(jjsj(url));
            sgworld.Creator.createPrimitivePolylineVectorGeoJsonFeatureLayerProvider(name, urls, data, lx, checked, "");
        } else {
            jjsj_layers.push(jjsj(url));
            sgworld.Creator.createStreetscapeGeoJsonFeatureLayer(name, urls, {}, lx, checked, "");

        }
    } else if (styletype == 'polylinelayer') {
        //sgworld.Creator.createPolylineGeoJsonFeatureLayer(name, urls, data, lx, checked, "");
        if (servertype == "vector") {
            urls.upperLevelLimit = 21;
            urls.lowerLevelLimit = 1;
            sgworld.Creator.createPrimitivePolylineVectorGeoJsonFeatureLayerProvider(name, urls, data, lx, checked, "");
        } else {
            sgworld.Creator.createPrimitiveGroundPolylineGeoJsonFeatureLayer(name, urls, {}, lx, checked, "");
        }
    } else if (styletype == 'polylinemodellayer') {
        //沿线模型分布
        //sgworld.Creator.createPolylineGeoJsonFeatureLayer(name, urls, data, lx, checked, "");
        if (servertype == "vector") {
        } else {
            sgworld.Creator.exectPointModel(name, urls, {}, lx, checked, "");
        }
    } else if (styletype == 'polygonmodellayer') {
        //面模型分布
        //sgworld.Creator.createPolylineGeoJsonFeatureLayer(name, urls, data, lx, checked, "");
        if (servertype == "vector") {
        } else {
            sgworld.Creator.createPolygonModel(name, urls, {}, lx, checked, "");
        }
    } else if (styletype == 'polygonlayer') {
        if (servertype == "vector") {
            urls.upperLevelLimit = 21;
            urls.lowerLevelLimit = 1;
            sgworld.Creator.createPolygonVectorGeoJsonFeatureLayerProvider(name, urls, {}, lx, checked, "");
        } else {
            //if (data.material.indexOf(".jpg") != -1) {
            //    //水面
            //    sgworld.Creator.createPolygonMapGeoJsonFeatureLayer(name, urls, {}, lx, checked, "");
            //} else {
            //    sgworld.Creator.createPolygonGeoJsonFeatureLayer(name, urls, {}, lx, checked, "");
            //}
        }
    } else if (styletype == 'modellayer') {
        if (servertype == "vector") {
        } else {
            sgworld.Creator.createModelPointGeoJsonFeatureLayer(name, urls, {}, lx, checked, "");
        }
    } else if (styletype == "polylinevolumelayer") {
        if (servertype == "vector") {
            urls.upperLevelLimit = 21;
            urls.lowerLevelLimit = 1;
            sgworld.Creator.createVolumeGeoJsonFeatureLayerProvider(name, urls, {}, lx, checked, "");
        } else {
            sgworld.Creator.createpolylineVolumeGeojsonFeatureLayer(name, urls, {}, lx, checked, "");
        }
    } else if (styletype == "polylineWallLayer") { //墙类型样式加载entity
        if (servertype == "vector") {
            urls.upperLevelLimit = 21;
            urls.lowerLevelLimit = 1;
            sgworld.Creator.createWallGeoJsonFeatureLayerProvider(name, urls, {}, checked, lx, "");
        } else {
            sgworld.Creator.createWallGeoFeatureLayer(name, urls, {}, lx, checked, "");
        }
    } else if (styletype == "primiviteModels") { //切片box全部加载
        sgworld.Creator.createPolygonVectorGeoJsonFeatureLayer(name, urls, {}, 1, 21, lx, checked, "");
    } else if (styletype == "primiviteWall") { //墙全加载Primitive
        if (servertype == "vector") {
        } else {
            sgworld.Creator.createWallPrimitiveGeoFeatureLayer(name, urls, {}, lx, checked, "");
        }
    } else if (styletype == "model") {
        if (servertype == "vector") {
        } else {
            var style = {
                //colors: data.material,
                show: checked
            }
            var date = {};
            sgworld.Creator.create3DTilesets(name, urls, date, style, lx, checked, "");
        }
    } else if (styletype == "pointcloudmodel") {
        if (servertype == "vector") {
        } else {
            sgworld.Creator.create3DTilesets(name, urls, {}, {}, lx, checked, "");
        }
    } else {
        sgworld.Creator.createGeoJsonFeatureLayer(name, urls, {}, lx, "");
    }
}